#include <iostream>

using namespace std;

int main()
{
	const int N = 1000;
	int result = 0;

	for(int i=3; i<N; i+=3)
	{
		result += i;
	}

	for(int i=5; i<N; i+=5)
	{
		if(i%3 != 0)
			result += i;
	}

	cout << result << endl;

	return 0;
}
